fix: prevent browser freeze when tessellating >50k vertices (#8219 )#8555
fix: prevent browser freeze when tessellating >50k vertices (#8219 )#8555Nixxx19 wants to merge 4 commits intoprocessing:mainfrom
Conversation
|
🎉 Thanks for opening this pull request! For guidance on contributing, check out our contributor guidelines and other resources for contributors! Thank You! |
|
Thanks for working on this! As this is into the |
|
|
||
| test('TESS mode skips prompt when p5.disableFriendlyErrors is true', function(done) { | ||
| var renderer = myp5.createCanvas(10, 10, myp5.WEBGL); | ||
| var confirmStub = sinon.stub(window, 'confirm').returns(false); |
There was a problem hiding this comment.
It looks like tests are currently failing here:
2) Graphics
p5.Graphics.resizeCanvas
Rendering
p5.prototype.resizeCanvas
p5.Framebuffer
sizing
p5.RendererGL
beginShape() in WEBGL mode
TESS mode skips prompt when p5.disableFriendlyErrors is true:
Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.
Does this test also take a while locally?
There was a problem hiding this comment.
sorry about that! the test was timing out because when p5.disableFriendlyErrors is true, the prompt is skipped and tessellation actually runs on 60k vertices, which is the freeze we're trying to guard against. fixed by stubbing _tesselateShape in the tests that would otherwise trigger real tessellation. also added an assertion that _tesselateShape is called in the disableFriendlyErrors case to confirm the code path is exercised. applied the same stub to the "only prompts once" test as well since confirm returns true there.
Resolves #8219
Summary
TESSshapes (>50,000 vertices) to avoid browser freezes inlibtessduring_triangulate()._largeTessellationAcknowledgedand tessellates normally without prompting again.p5.disableFriendlyErrors/ minified builds: when friendly errors are disabled, tessellation always runs with no prompt.Tests
test/unit/webgl/p5.RendererGL.jsto cover:p5.disableFriendlyErrorsistrue.Screenshot
PR Checklist
npm run lintpasses